// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router';

// 导入 .vue 文件组件
import ReaderView from '../views/ReaderView.vue';
import AdminView from '../views/AdminView.vue';
import FeedbackForm from '../components/FeedbackForm.vue';
import StatusQuery from '../components/StatusQuery.vue';
// import NotFoundComponent from '../views/NotFound.vue'; // (如果创建了404页面)

const routes = [
  {
    path: '/',
    component: ReaderView, // 使用导入的 .vue 组件
    children: [
      { path: '', name: 'SubmitFeedback', component: FeedbackForm }, // 默认子路由
      { path: 'query', name: 'StatusQuery', component: StatusQuery },
    ]
  },
  {
    path: '/admin',
    name: 'Admin',
    component: AdminView, // 使用导入的 .vue 组件
    // 在这里添加路由守卫 (meta: { requiresAuth: true }) 以进行后台认证
  },
  // { path: '/:pathMatch(.*)*', name: 'NotFound', component: NotFoundComponent },
];

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
});

export default router;